%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% This file is part of the book
%%
%% Algorithmic Graph Theory
%% http://code.google.com/p/graphbook/
%%
%% Copyright (C) 2009--2013 Minh Van Nguyen <mvngu.name@gmail.com>
%%
%% See the file COPYING for copying conditions.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{algorithmic}[1]
%% input and output
\Require Two undirected simple graphs $G_1$ and $G_2$, each having $n$
  vertices.
\Ensure \MyTrue if $G_1 \cong G_2$; \MyFalse otherwise.
%%
%% algorithm body
\For{$i \gets 1, 2$}
  \State $A_i \gets$ adjacency matrix of $G_i$
  \State $p_i \gets$ permutation equivalence class of $A_i$
  \State $A_i' \gets$ lexicographically maximal element of $p_i$
\EndFor
\If{$A_1' = A_2'$}
  \State \Return \MyTrue
\EndIf
\State \Return \MyFalse
\end{algorithmic}
